package com.teejdeej.simpleneuralgame;

import java.util.List;
import java.util.Random;

public class SimpleBlindAI implements Player{
	private Random random = new Random();

	@Override
	public void learn(List<int[][]> boards, List<int[]> positions,
			List<Move> moves) {
	}

	@Override
	public Move move(int[][] board, int[] position) {
		Move mymove = new Move();
		if(board[position[0]-1][position[1]] == MainGame.BoardWall) {
			mymove.m_moveDirection = MainGame.DirectionRight;
		}
		else if(board[position[0]+1][position[1]] == MainGame.BoardWall) {
			mymove.m_moveDirection = MainGame.DirectionLeft;
		}
		else if(board[position[0]][position[1]-1] == MainGame.BoardWall) {
			mymove.m_moveDirection = MainGame.DirectionDown;
		}
		else if(board[position[0]][position[1]+1] == MainGame.BoardWall) {
			mymove.m_moveDirection = MainGame.DirectionUp;
		}
		else {
			mymove.m_moveDirection = random.nextInt(4);
		}
		mymove.m_move = true;
		return mymove;
	}

}
